88 research outputs found
Unlocking Blocked Communicating Processes
We study the problem of disentangling locked processes via code refactoring.
We identify and characterise a class of processes that is not lock-free; then
we formalise an algorithm that statically detects potential locks and propose
refactoring procedures that disentangle detected locks. Our development is cast
within a simple setting of a finite linear CCS variant \^a although it suffices
to illustrate the main concepts, we also discuss how our work extends to other
language extensions.Comment: In Proceedings WWV 2015, arXiv:1508.0338
Session Types as Generic Process Types
Behavioural type systems ensure more than the usual safety guarantees of
static analysis. They are based on the idea of "types-as-processes", providing
dedicated type algebras for particular properties, ranging from protocol
compatibility to race-freedom, lock-freedom, or even responsiveness. Two
successful, although rather different, approaches, are session types and
process types. The former allows to specify and verify (distributed)
communication protocols using specific type (proof) systems; the latter allows
to infer from a system specification a process abstraction on which it is
simpler to verify properties, using a generic type (proof) system. What is the
relationship between these approaches? Can the generic one subsume the specific
one? At what price? And can the former be used as a compiler for the latter?
The work presented herein is a step towards answers to such questions.
Concretely, we define a stepwise encoding of a pi-calculus with sessions and
session types (the system of Gay and Hole) into a pi-calculus with process
types (the Generic Type System of Igarashi and Kobayashi). We encode session
type environments, polarities (which distinguish session channels end-points),
and labelled sums. We show forward and reverse operational correspondences for
the encodings, as well as typing correspondences. To faithfully encode session
subtyping in process types subtyping, one needs to add to the target language
record constructors and new subtyping rules. In conclusion, the programming
convenience of session types as protocol abstractions can be combined with the
simplicity and power of the pi-calculus, taking advantage in particular of the
framework provided by the Generic Type System.Comment: In Proceedings EXPRESS/SOS 2014, arXiv:1408.127
Retrofitting Typestates into Rust
Funding Information: Acknowledgements. We thank Bernardo Toninho, Daniel Henry-Mantilla, João Mota, Mathias Jakobsen, Ornela Dardha, Philip Munks-gaard, Simon Fowler, Tomás Alagoa and Wen Kokke for their comments on previous versions of this paper, and the reviewers’. This work is partially supported by NOVA LINCS (UIDB/04516/2020) with the financial support of FCT.IP and by the EU H2020 RISE programme under the Marie Skłodowska-Curie grant agreement No. 778233 (BehAPI). Publisher Copyright: © 2021 Owner/Author.As software permeates our lives, bugs become increasingly expensive; the best way to reduce their cost is to reduce the number of bugs. Of course, this is easier said than done and, at best, we can go after their root causes to mitigate them. One of such causes is state, whether it is the state of a light bulb (i.e. on/off), or the state of a complex protocol, reasoning about state is a complex process which developers are required to do with subpar tools. Ideally, we want to specify constraints and have the computer reason for us; typestates enable developers to describe states using the type system and allow the compiler to reason about them. We propose an approach to bring typestates to Rust, without any external tools, leveraging only Rust's type and macro systems. Our approach provides a macro-based domain-specific language which enables developers to easily express and implement typestates, along with certain state machine safety guarantees, it is open-source and available at https://github.com/rustype/typestate-rs.publishersversionpublishe
Modular session types for objects
Session types allow communication protocols to be specified
type-theoretically so that protocol implementations can be verified by static
type checking. We extend previous work on session types for distributed
object-oriented languages in three ways. (1) We attach a session type to a
class definition, to specify the possible sequences of method calls. (2) We
allow a session type (protocol) implementation to be modularized, i.e.
partitioned into separately-callable methods. (3) We treat session-typed
communication channels as objects, integrating their session types with the
session types of classes. The result is an elegant unification of communication
channels and their session types, distributed object-oriented programming, and
a form of typestate supporting non-uniform objects, i.e. objects that
dynamically change the set of available methods. We define syntax, operational
se-mantics, a sound type system, and a sound and complete type checking
algorithm for a small distributed class-based object-oriented language with
structural subtyping. Static typing guarantees that both sequences of messages
on channels, and sequences of method calls on objects, conform to
type-theoretic specifications, thus ensuring type-safety. The language includes
expected features of session types, such as delegation, and expected features
of object-oriented programming, such as encapsulation of local state.Comment: Logical Methods in Computer Science (LMCS), International Federation
for Computational Logic, 201
- …